#include "gtest/gtest.h"

#include "BreakPointService.h"

TEST(BreakPointServiceStatusTest, startAndStop){

    BreakPointService service;
    ASSERT_TRUE(service.isEndStatus());

    service.start();
    ASSERT_TRUE(service.isInitedStatus());

    service.connected();
    ASSERT_TRUE(service.isConnectedStatus());

    service.receivedLoginResp("login-rsp");
    ASSERT_TRUE(service.isLoginedStatus());

    service.timeout();
    service.receivedBreakPointResp("breakpoint-rsp");

    service.receivedNormalResp("normal");

    service.disconnected();
    ASSERT_TRUE(service.isDisconnectedStatus());

    service.stop();
    ASSERT_TRUE(service.isEndStatus());
}

TEST(BreakPointServiceStatusTest, errorUse){
    BreakPointService service;
    service.start();
    ASSERT_TRUE(service.isInitedStatus());


    ASSERT_EQ(-1, service.disconnected()); // switch status, check failed 
    ASSERT_TRUE(service.isInitedStatus());

    ASSERT_EQ(0, service.connected()); //switch OK 
    ASSERT_TRUE(service.isConnectedStatus());

    service.stop();
    ASSERT_TRUE(service.isEndStatus());
}


//TODO: 
TEST(BreakPointServiceStatusTest, newIf){
    //BreakPointService * service = new BreakPointServiceImp();
    //delete service;
}
